﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.EntityClient;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestSystem.Domain.Entities;
using TestSystem.Domain.Entities.Candidate;
using TestSystem.Domain.Entities.Position;
using TestSystem.Domain.Entities.Questions;
using TestSystem.Domain.Entities.Authorisation;

namespace TestSystem.Domain.DAL
{
    public class TestSystemContext : DbContext
    {
        public DbSet<Category> Categories { get; set; }

        //Questions
        public DbSet<Question> Questions { get; set; } 
        public DbSet<QuestionAttribute> QuestionAttributes { get; set; } 
        public DbSet<QuestionAttributeType> QuestionAttributeTypes { get; set; } 
        public DbSet<QuestionType> QuestionTypes { get; set; } 
        public DbSet<ChoiceQuestionAnwser> ChoiceQuestionAnwsers { get; set; } 
        public DbSet<ChoiceAnwserType> ChoiceAnwserTypes { get; set; } 
        public DbSet<OpenQuestionAnwser> OpenQuestionAnwsers { get; set; } 
        public DbSet<Difficulty> Difficulties { get; set; } 

        //Position
        public DbSet<Position> Positions { get; set; }
        public DbSet<QuestionDifficultyToPosition> QuestionDifficultyToPositions { get; set; }
        public DbSet<QuestionTypeToPosition> QuestionTypeToPositions { get; set; }
        public DbSet<CategoryToPosition> CategoryToPositions { get; set; }

        //User
        public DbSet<User> Users { get; set; }
        public DbSet<Role> Roles { get; set; }

        public DbSet<Candidate> Candidates { get; set; } 

        public TestSystemContext()
            : base("name=TestSystem")
        {
            
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}
